package io.virtualapp.utils;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;

/**
 * Created by qp
 * PackageName VirtualApp
 * 2018/8/9 11:19
 */

public class CheckApkExist {
    /**
     * 判断某app应用是否存在手机中
     * @param context
     * @param packageName
     * @return
     */
    public static boolean checkApkExist(Context context, String packageName){
        if (TextUtils.isEmpty(packageName))
            return false;
        try {
            ApplicationInfo info = context.getPackageManager()
                    .getApplicationInfo(packageName,
                            PackageManager.GET_UNINSTALLED_PACKAGES);

            return true;
        } catch (PackageManager.NameNotFoundException e) {
           return false;
        }
    }

    public static boolean checkFacebookExist(Context context,String pakegeName){
        return checkApkExist(context, pakegeName);
    }


}
